Spring Security
Spring プロジェクトのひとつ
https://spring.io/projects/spring-security
Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications.
Spring Security is a framework that focuses on providing both authentication and authorization to Java applications. Like all Spring projects, the real power of Spring Security is found in how easily it can be extended to meet custom requirements
from Spring 徹底入門 Spring Framework による Java アプリケーション開発
Spring ベースのアプリケーションで、認証や認可などのセキュリティ要件を容易に実現するためのフレームワーク
CSRF 対策機能やセキュリティヘッダー出力機能、セッション管理機能なども提供
特徴
豊富なオプション
豊富な拡張ポイント
テストには Spring Security Test を利用できる
from Spring 解体新書 第 2 版
認証と認可の機能がある
セキュリティ設定クラスの用意
@EnableWebSecurity アノテーション
@Configuration アノテーション
WebSecurityConfigurerAdapter クラスを継承
パスワードの暗号化 : PasswordEncoder
CSRF 対策
th:action 属性を使っていると自動的に CSRF 対策がなされる